import request from "./axios/index";
/**
 *@param  {any} image //图片
 *@param  {{type,targetColor,replaceColor}} colors //颜色配置
 *@param {'hex'|'rgb'} type //色值类型
 *@param {string|[number,number,number]} targetColor //被替换的色值
 *@param {string|[number,number,number]} replaceColor //替换的色值
 *@param {number} deltaE //精确度
 *@return base64
 */
export const replaceColor = (image, colors, deltaE) => {
  return request({
    url: "/api/users/replaceColor",
    method: "POST",
    data: {
      image,
      colors,
      deltaE,
    },
  });
};
/* {
  "image":"../express-demo/public/images/panpanB.jpg",
  "colors":{
      "type":"rgb",
      "targetColor":[230,227,218],
      "replaceColor":[55,55,55]
  },
  "deltaE":20
} */
